home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr18 / chessclk.zip / SOUND.C < prev    next >
C/C++ Source or Header  |  1995-04-15  |  2KB  |  99 lines

  1. // Sound Module
  2. // M\Cooper, 3425 Chestnut Ridge Rd., Grantsville, MD 21536-9801
  3.  
  4.  
  5. #include <dos.h>
  6.  
  7.  
  8. #define FREQ 900
  9. #define DELAY 100
  10.  
  11. void beep1(),
  12.     beep2();
  13.  
  14. /***************************************************************************/
  15. /*                                   BEEPS                                 */
  16. /***************************************************************************/
  17.  
  18. void beep1()
  19. {
  20.      sound( FREQ );
  21.      delay( DELAY );
  22.      nosound();
  23.      return;
  24. }
  25.  
  26. void beep2()
  27. {
  28.      beep1();
  29.      delay( DELAY / 2 );
  30.      beep1();
  31.      return;
  32. }
  33.  
  34. /**********************************TONE***********************************/
  35. /*         Produces tone at frequency, duration (of sound)               */
  36. /*     Arguments in: freq [in Hz], dur [duration in millisec.]           */
  37. /*************************************************************************/
  38.  
  39. void tone( int freq, int dur )
  40. {
  41.         sound( freq );
  42.         delay( dur );
  43.         nosound();
  44.         return;
  45. }
  46.  
  47. /**************************************************************************/
  48. /*                 Produces a "two-tone" sound  (beep-boop)               */
  49. /**************************************************************************/
  50. void two_tone()
  51.  
  52. {
  53.     int frequency,
  54.          duration;
  55.  
  56.         frequency = 700;
  57.         duration  = 165;
  58.         tone( frequency, duration );
  59.  
  60.         frequency = 450;
  61.         duration = 110;
  62.         tone( frequency, duration );
  63.  
  64. }
  65.  
  66.  
  67.  
  68. /**************************************************************************/
  69. /*                                   BELL                                 */
  70. /*                   Produces a succession of 'beep' tones                */
  71. /*               Takes 'times' as argument [# of times to beep]           */
  72. /**************************************************************************/
  73.  
  74. void bell( int times )
  75.  
  76. {
  77.         while( times-- )
  78.             {
  79.             tone(380,165);
  80.             delay (20 );
  81.             }
  82.         return;
  83. }
  84.  
  85. /**************************************************************************/
  86. /*                                   BLATT                                */
  87. /*                         Produces a "Bronx Cheer"                       */
  88. /*                         [use with error routine]                       */
  89. /**************************************************************************/
  90.  
  91. void blatt()
  92.  
  93. {
  94.         tone( 42,330 ); 
  95.         tone(34,220);
  96.         return;  
  97. }
  98.  
  99.